/**
 * 
 * @param {Function} handle 需要处理的逻辑
 * @param {Number} threshold 滚动条距离底部的阈值
 */
function lazyLoad(handle, threshold = 100) {
    let flag = true;//开关是开的
    window.onscroll = function () {
        //获取关键属性
        let scrollTop = document.documentElement.scrollTop;//被滚动条卷去的内容高度
        let scrollHeight = document.documentElement.scrollHeight;//整体的内容高度
        let clientHeight = document.documentElement.clientHeight;//可视区的高度
        // console.log("====scrollTop"+scrollTop)
        // console.log("=====scrollHeight"+scrollHeight)
        // console.log("=====clientHeight"+clientHeight)
        //滚动的时候,求滚动条距离底部还有多少距离
        let dynamicThreshold = scrollHeight - (scrollTop + clientHeight)
        if (dynamicThreshold <= threshold) {
            //需要加载内容了
            if (flag) {
                flag = false;//立马关掉
                handle()
            }

        } else {
            flag = true;//重新打开开关
        }
    }

}